package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class Findbook implements Operate{
    @Override
    public void work(BookList books) {
        System.out.println("查找书籍....");
        Scanner scanner=new Scanner(System.in);
        System.out.print("请输入要查找书籍的名字：-->");
        String name=scanner.nextLine();
        int count=books.getUsedbooks();
        for(int i=0;i<count;i++)
        {
            Book book=books.getbook(i);
            if(book.getName().equals(name)){
                System.out.println("找到了,书本内容如下：");
                System.out.println(book);
                System.out.println();
                return;
            }
        }
        System.out.println("很抱歉，没有查找到你要查找的书籍");
        System.out.println("后续会尽快联系管理员添加~");
        System.out.println();
    }
}
